<?php
/**
 * 文章编辑模板
 * User: crstu
 * Date: 2016/5/27
 * Time: 14:16
 */

use  common\widgets\ActiveForm;
use common\widgets\FormTable;
use common\models\DAO\ArticleType;

$form = ActiveForm::begin();

echo FormTable::widget([
    'model' => $model,
    'form' => $form,
    'rows' => [
        'title' => ['type' => FormTable::INPUT_TEXT],
        'typeID' => [
            'type' => FormTable::INPUT_WIDGET,
            'widgetClass' => 'common\widgets\SelectTree',
            'options' => [
                'pluginOptions' => [
                    'data' => ArticleType::find()->where(['type' => 'general'])->asArray()->all(),
                    'columnPid' => 'parentID',
                    'columnName' => 'typeName',
                    'initValue' => '--请选择分类--',
                ]
            ]
        ],
        'thumb' => [
            'type' => FormTable::INPUT_WIDGET,
            'widgetClass' => 'common\widgets\UploadImage',
        ],
        'description' => [
            'type' => FormTable::INPUT_TEXTAREA,
        ],
        'content' => [
            'type' => FormTable::INPUT_WIDGET,
            'widgetClass' => 'common\widgets\Simditor',
            'options' => [
                'pluginOptions' => [
                    'options' => ['placeholder' => '',],
                ]
            ],
            'width' => '8'
        ],
        'sort' => ['type' => FormTable::INPUT_TEXT, 'width' => 1],
    ],
]);
ActiveForm::end();
